package vista;
//import info.clearthought.layout.TableLayout;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTable;

import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;



/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class FormReporte extends javax.swing.JFrame {
	private JScrollPane jScrollPane1;
	private JSeparator jSeparator1;
	private JLabel jLabel1;
	private JRadioButton optDes;
	private JRadioButton optAsc;
	private JTable Tabla;
	private Object VAL[][];
	private String Titulo[];
	

    
	public JRadioButton getOptDes()
	{
		return optDes;
	}
	public void setOptDes(JRadioButton optDes) 
    {
		this.optDes = optDes;
		optDes.setFont(new java.awt.Font("Purisa",1,14));
	}
	public JRadioButton getOptAsc()
	{
		return optAsc;
	}
	public void setOptAsc(JRadioButton optAsc) {
		this.optAsc = optAsc;
		optAsc.setFont(new java.awt.Font("Purisa",1,14));
	}
    
	public FormReporte() {
		super();
		initGUI();
		CargarTabla();
	}
	public FormReporte(Object VAL[][],String Titulo[])
	{
		super();
		this.Titulo = Titulo;
		this.VAL = VAL;
		initGUI();
		this.optDes.setSelected(true);
		CargarTabla();
		getContentPane().setBackground(Color.white);
	}
	
	public void addlistenerAsc(ActionListener al)
	{
		optAsc.addActionListener(al);
	}
	public void addlistenerDes(ActionListener al)
	{
		optDes.addActionListener(al);
	}
	
	private void initGUI() {
		try {
			ButtonGroup grp = new ButtonGroup();
			getContentPane().setLayout(null);
			getContentPane().setBackground(Color.white);
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				jScrollPane1 = new JScrollPane();
				getContentPane().add(jScrollPane1, "0, 0");
				jScrollPane1.setBounds(33, 77, 457, 142);
			}
			{
				optAsc = new JRadioButton();
				getContentPane().add(optAsc);
				optAsc.setText("Ascendente");
				optAsc.setBounds(136, 50, 113, 18);
				grp.add(optAsc);
			}
			{
				optDes = new JRadioButton();
				getContentPane().add(optDes);
				{
					jLabel1 = new JLabel();
					getContentPane().add(jLabel1);
					jLabel1.setText("Reporte");
					jLabel1.setBounds(219, 6, 114, 34);
					jLabel1.setFont(new java.awt.Font("Purisa",1,22));
				}
				{
					jSeparator1 = new JSeparator();
					getContentPane().add(jSeparator1);
					jSeparator1.setBounds(197, 38, 154, 10);
				}
				{
					Tabla = new JTable();
					getContentPane().add(Tabla);
				}
				optDes.setText("Descendente");
				optDes.setBounds(260, 50, 148, 18);
				grp.add(optDes);
			}
			{
				Tabla = new JTable();
				getContentPane().add(Tabla);
				Tabla.setBounds(33, 75, 457, 250);
				Tabla.setShowVerticalLines(false);
				Tabla.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				Tabla.setOpaque(false);
			}
			pack();
			this.setSize(538, 389);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public void InvertirValores(int n,int c)
	{
		Object _VAL[][] = new Object[n][c];
		for(int i = 0,x = n-1;i < n;i++,x--)
			for(int j = 0;j < c;j++)
				_VAL[x][j] = VAL[i][j];
		
		for(int i= 0;i < n;i++)
			for(int j = 0;j < c;j++)
				VAL[i][j] = _VAL[i][j];
	}
	public void CargarTabla()
	{
		TableModel jTable1Model = 
		new DefaultTableModel
		(VAL,Titulo);
		
		Tabla = new JTable();
		jScrollPane1.setViewportView(Tabla);
		Tabla.setModel(jTable1Model);
		Tabla.setBounds(33, 79, 457, 227);
		Tabla.setShowVerticalLines(false);
		Tabla.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
		Tabla.setToolTipText("");
		Tabla.setOpaque(false);
	}
	public void CargarTabla(Object VAL[][],String Titulo[])
	{
		this.Titulo = Titulo;
		this.VAL = VAL;
		
		TableModel jTable1Model = 
		new DefaultTableModel
		(VAL,Titulo);

		Tabla.setModel(jTable1Model);
		Tabla.setBounds(71, 308, 457, 35);
		Tabla.setShowVerticalLines(false);
		Tabla.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
		Tabla.setToolTipText("");
		Tabla.setOpaque(false);
		Tabla.setPreferredSize(new java.awt.Dimension(601, 149));
	}

}
